<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>散标内容页</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>
    <div id="list"></div>
</body>

<script type="text/template" id="template">
    <!-- 头部 -->
    
    <header class="aui-bar aui-bar-nav">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">{{=it.name}} {{=it.deal_sn}}</div>
    </header>
    <!-- 智投内容 -->
    <div class="licai-sanbiao-t">
        {{? it.repay_time == 1}}
        <div class="licai-sanbiao-t-icon">
            新手
        </div>
        <div class="licai-sanbiao-t-icon-bg"></div>
        {{?}}
        <p>预期年化利率(%)</p>
        {{=it.rate}}
        <div class="j">
            <div class="aui-progress">
                <div class="aui-progress-bar" style="width:{{=it.progress_point}}%;"></div>
            </div>
            <p>{{=it.progress_point}}%</p>
        </div>
        <p onclick="buy_people({{=it.id}})" tapmode><span class="fa fa-address-book-o"></span>已有<i id="num"></i>人购买<span class="fa fa-angle-right"></span></p>
        <ul>
            <li><p>{{=it.borrow_amount/10000}}</p>融资金额(万元)</li>
            <li><p class="money">{{=it.surplusmoney}}</p>可投金额(元)</li>
            <li><p>{{=it.repay_time}}</p>项目期限(月)</li>
        </ul>
    </div>
    <div class="aui-content aui-margin-t-15">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-item">
                <div class="aui-list-item-inner"> <div class="aui-list-item-title">还款方式</div>
                <div class="aui-list-item-right">{{? it.loantype==0}}等额本息{{?? it.loantype==1}}每月付息，到期还本{{?? it.loantype==2}}到期还本息{{?? it.loantype==3}}先息后本{{??}}{{?}}</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title">起投金额(元)</div>
                <div class="aui-list-item-right money">{{=it.min_loan_money}}</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title">投资上限(元)</div>
                <div class="aui-list-item-right">{{? it.max_loan_money==0}}无上限{{??}}{{=it.max_loan_money}}{{?}}</div>
            </div>
        </li>
    </ul>
</div>
<div class="aui-content aui-margin-t-15">
    <ul class="aui-list aui-list-in">
        <li class="aui-list-item aui-list-item-middle" onclick="pro_info({{=it.id}})" tapmode>
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">项目介绍</div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle" onclick="auth({{=it.id}})" tapmode>
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">认证及文件</div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle" onclick="safe()" tapmode>
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">安全保障</div>
            </div>
        </li>
    </ul>
</div>
<div class="licai-zhitou-btn aui-btn-info">请前往开通存管账户</div>

</script>


<script type="text/javascript">

    apiready = function(){
        var id = api.pageParam.id;
        load_list(id);
    }

    // 加载列表
    function load_list(id) {

        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        api.ajax({
            url: webAddress+'/index.php?ctl=app_deal&act=deal&id='+id,
            method: 'get',
        },function(ret, err){

            if (ret) {

                if (ret.status == 0) {
                    alert(ret.info);
                }else {
                    // alert( JSON.stringify( ret ) );
                    api.hideProgress();
                    var num = ret.load_list;
                    updateList(ret.deal, num.length);
                }
            } else {
                // alert( JSON.stringify( err ) );
                alert(err.msg);
                api.hideProgress();
                api.closeWin({
                });
            }
        });
    }

    // doT
    function updateList(data, num){

        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var list = $api.byId('list');
        $api.html(list, html); 
        $(".money").each(function(){
            // alert($(this).text());
            var tmp = outputmoney($(this).text());
            $(this).text(tmp);
        });
        document.getElementById('num').innerHTML = num;
    }

    // 已购人数
    function buy_people(id) {
        api.openWin({
            name: 'licai_record',
            url: './licai-record.html',
            pageParam: {
                id: id
            }
        });
    }

    // 项目介绍
    function pro_info(id) {
        api.openWin({
            name: 'licai_proinfo',
            url: './licai-proinfo.html',
            pageParam: {
                id: id
            }
        });
    }

    // 认证文件
    function auth(id) {
        api.openWin({
            name: 'licai_authentication',
            url: './licai-authentication.html',
            pageParam: {
                id: id
            }
        });
    }

    // 安全保障
    function safe() {

    }



</script>
</html>